import turtle


def drawMainRegion(color):
    global width, height
    turtle.pendown()
    turtle.pencolor(color)
    turtle.fillcolor(color)

    # 开始画
    turtle.begin_fill()
    turtle.forward(width)
    turtle.left(90)
    turtle.forward(height / 3)
    turtle.left(90)
    turtle.forward(width)
    turtle.left(90)
    turtle.forward(height / 3)
    turtle.left(90)
    turtle.end_fill()


if __name__ == "__main__":
    width = 800
    height = 500
    turtle.Screen()
    turtle.setup(width, height)
    turtle.shape("blank")
    turtle.speed(10)

    turtle.penup()
    turtle.goto(-width / 2, -height / 2)
    colors = ["red", "blue", "white"]
    i = 0
    for color in colors:
        if i != 0:
            turtle.penup()
            turtle.setheading(90)
            turtle.forward(height / 3)
            turtle.setheading(0)
        drawMainRegion(color)
        i = i + 1

    turtle.done()



